﻿<ctrls:Exercicio x:Class="Visualizacao3D.Exercicio09.Exercicio09"
                 xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                 xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                 xmlns:p3d="http://www.codeplex.com/perspective"
                 xmlns:tools="clr-namespace:_3DTools;assembly=3DTools"
                 xmlns:ctrls="clr-namespace:Visualizacao3D.Controls">

    <ctrls:Exercicio.Resources>
        <ResourceDictionary>
            <ResourceDictionary.MergedDictionaries>
                <ResourceDictionary Source="Exercicio09_MaterialResources.xaml" />
                <ResourceDictionary Source="Exercicio09_TransformResources.xaml" />
            </ResourceDictionary.MergedDictionaries>
        </ResourceDictionary>
    </ctrls:Exercicio.Resources>

    <!--
    EXERCÍCIO 9
    
    Definições:
    1 u = 1 m
    1 u = 2 kN
    Diagramas:
    1 u = 2 kN
    -->

    <tools:TrackballDecorator x:Name="MainTrackballDecorator">
        <Viewport3D x:Name="MainViewport">
            <Viewport3D.Camera>
                <PerspectiveCamera Position="4,2,5"
                                   LookDirection="-4,-2,-5"
                                   UpDirection="0,1,0" />
            </Viewport3D.Camera>
            <ModelVisual3D>
                <ModelVisual3D.Content>
                    <Model3DGroup>
                        <DirectionalLight Color="#FFFFFFFF"
                                          Direction="-10, 0, -15" />
                        <DirectionalLight Color="#FFFFFFFF"
                                          Direction="10, 0, 15" />
                        <DirectionalLight Color="#FFFFFFFF"
                                          Direction="0, -10, 0" />
                    </Model3DGroup>
                </ModelVisual3D.Content>
            </ModelVisual3D>

            <tools:ScreenSpaceLines3D Transform="{StaticResource Transform_Geral}"
                                      Thickness="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type ctrls:ExercicioFrame}}, Path=MostrarBoundingBox, Converter={StaticResource BooleanToBoundingBoxThicknessConverter}}"
                                      Points="0,0,0 4,0,0 
                                                  0,1,0 4,1,0 
                                                  0,0,2 4,0,2
                                                  0,1,2 4,1,2
                                                  0,0,0 0,1,0
                                                  4,0,0 4,1,0
                                                  0,0,2 0,1,2
                                                  4,0,2 4,1,2
                                                  0,0,0 0,0,2
                                                  4,0,0 4,0,2
                                                  0,1,0 0,1,2
                                                  4,1,0 4,1,2"
                                      Color="Gray" />

            <ContainerUIElement3D x:Name="MainContainer"
                                  Transform="{StaticResource Transform_Geral}">
                <ContainerUIElement3D.Children>

                    <p3d:XyzAxis3D Color="Red" x:Name="Eixos"
                                   Visibility="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type ctrls:ExercicioFrame}}, Path=MostrarEixos, Converter={StaticResource BooleanToVisibilityConverter}}" />

                    <!-- Engastamento -->
                    <ContainerUIElement3D x:Name="Apoios"
                                          Visibility="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type ctrls:ExercicioFrame}}, Path=MostrarApoios, Converter={StaticResource BooleanToVisibilityConverter}}">
                        <ContainerUIElement3D.Children>
                            <!-- Easter Egg! -->
                            <p3d:Square3D x:Name="EasterEgg"
                                          Material="{StaticResource Material_Nakao}"
                                          BackMaterial="{Binding RelativeSource={RelativeSource Self}, Path=Material}"
                                          Transform="{StaticResource Transform_EasterEgg}"
                                          Visibility="{Binding ElementName=Eixos, Path=Visibility}"
                                          ToolTipService.ToolTip="Prof. Osvaldo Nakao" />
                            <!-- Fim Easter Egg! -->
                            <p3d:Box3D ToolTipService.ToolTip="Nó A (Engastamento)"
                                       x:Name="Engastamento"
                                       Material="{StaticResource Material_Barra}"
                                       BackMaterial="{x:Null}"
                                       Transform="{StaticResource Transform_Engastamento}" />
                        </ContainerUIElement3D.Children>
                    </ContainerUIElement3D>

                    <!-- Barras - Definição: O ponto A é o engastamento -->
                    <ContainerUIElement3D Visibility="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type ctrls:ExercicioFrame}}, Path=MostrarBarras, Converter={StaticResource BooleanToVisibilityConverter}}"
                                          x:Name="Barras">
                        <ContainerUIElement3D.Children>
                            <p3d:Bar3D x:Name="BarraAB"
                                       ToolTipService.ToolTip="4 m"
                                       SideCount="50"
                                       RoundingRate="0.15"
                                       Material="{StaticResource Material_Barra}"
                                       BackMaterial="{x:Null}"
                                       Transform="{StaticResource Transform_BarraAB}" />
                            <p3d:Bar3D x:Name="BarraBC"
                                       ToolTipService.ToolTip="1 m"
                                       SideCount="50"
                                       RoundingRate="0.15"
                                       Material="{StaticResource Material_Barra}"
                                       BackMaterial="{x:Null}"
                                       Transform="{StaticResource Transform_BarraBC}" />
                            <p3d:Bar3D x:Name="BarraCD"
                                       ToolTipService.ToolTip="2 m"
                                       SideCount="50"
                                       RoundingRate="0.15"
                                       Material="{StaticResource Material_Barra}"
                                       BackMaterial="{x:Null}"
                                       Transform="{StaticResource Transform_BarraCD}" />
                        </ContainerUIElement3D.Children>
                    </ContainerUIElement3D>
                    <!-- Nós -->
                    <ContainerUIElement3D Visibility="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type ctrls:ExercicioFrame}}, Path=MostrarBarras, Converter={StaticResource BooleanToVisibilityConverter}}"
                                          x:Name="Nos">
                        <ContainerUIElement3D.Children>
                            <p3d:Spherical3D x:Name="NoB"
                                             ToolTipService.ToolTip="Nó B"
                                             Material="{StaticResource Material_Barra}"
                                             BackMaterial="{x:Null}"
                                             Transform="{StaticResource Transform_NoB}" />
                            <p3d:Spherical3D x:Name="NoC"
                                             ToolTipService.ToolTip="Nó C"
                                             Material="{StaticResource Material_Barra}"
                                             BackMaterial="{x:Null}"
                                             Transform="{StaticResource Transform_NoC}" />
                            <p3d:Spherical3D x:Name="NoD"
                                             ToolTipService.ToolTip="Nó D"
                                             Material="{StaticResource Material_Barra}"
                                             BackMaterial="{x:Null}"
                                             Transform="{StaticResource Transform_NoD}" />
                        </ContainerUIElement3D.Children>
                    </ContainerUIElement3D>

                    <!-- Forcas -->
                    <ContainerUIElement3D Visibility="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type ctrls:ExercicioFrame}}, Path=MostrarVetores, Converter={StaticResource BooleanToVisibilityConverter}}"
                                          x:Name="Forcas">
                        <ContainerUIElement3D.Children>
                            <p3d:Arrow3D x:Name="ForcaC"
                                         ToolTipService.ToolTip="2 kN"
                                         Length="2"
                                         Material="{StaticResource Material_VetorForca}"
                                         BackMaterial="{x:Null}"
                                         Transform="{StaticResource Transform_ForcaC}" />
                            <p3d:Arrow3D x:Name="ForcaD"
                                         ToolTipService.ToolTip="1 kN"
                                         Length="1"
                                         Material="{StaticResource Material_VetorForca}"
                                         BackMaterial="{x:Null}"
                                         Transform="{StaticResource Transform_ForcaD}" />
                        </ContainerUIElement3D.Children>
                    </ContainerUIElement3D>

                    <!-- Momentos -->
                    <ContainerUIElement3D Visibility="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type ctrls:ExercicioFrame}}, Path=MostrarVetores, Converter={StaticResource BooleanToVisibilityConverter}}"
                                          x:Name="Momentos">
                        <ContainerUIElement3D.Children>
                            <p3d:Conical3D x:Name="MomentoBHead"
                                           ToolTipService.ToolTip="2 kN.m"
                                           SideCount="50"
                                           Material="{StaticResource Material_VetorMomento}"
                                           BackMaterial="{x:Null}"
                                           Transform="{StaticResource Transform_MomentoBHead}" />
                            <p3d:Arrow3D x:Name="MomentoBTail"
                                         ToolTipService.ToolTip="2 kN.m"
                                         Length="2"
                                         Material="{StaticResource Material_VetorMomento}"
                                         BackMaterial="{x:Null}"
                                         Transform="{StaticResource Transform_MomentoBTail}" />
                        </ContainerUIElement3D.Children>
                    </ContainerUIElement3D>

                    <!-- Graficos -->

                    <!-- Cortantes -->
                    <ContainerUIElement3D x:Name="Graficos_Cortantes"
                                          Visibility="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type ctrls:ExercicioFrame}}, Path=MostrarGraficosCortantes, Converter={StaticResource BooleanToVisibilityConverter}}">
                        <ContainerUIElement3D.Children>
                            <p3d:Square3D x:Name="Grafico_CortanteAB"
                                          Material="{StaticResource Material_Grafico_CortanteAB}"
                                          BackMaterial="{Binding RelativeSource={RelativeSource Self}, Path=Material}"
                                          Transform="{StaticResource Transform_Grafico_CortanteAB}"
                                          ToolTipService.ToolTip="Cortante - AB: -1 kN" />
                            <p3d:Square3D x:Name="Grafico_CortanteCD"
                                          Material="{StaticResource Material_Grafico_CortanteCD}"
                                          BackMaterial="{Binding RelativeSource={RelativeSource Self}, Path=Material}"
                                          Transform="{StaticResource Transform_Grafico_CortanteCD}"
                                          ToolTipService.ToolTip="Cortante - CD: +1 kN" />
                        </ContainerUIElement3D.Children>
                    </ContainerUIElement3D>
                    <!-- Fletores -->
                    <ContainerUIElement3D x:Name="Graficos_Fletores"
                                          Visibility="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type ctrls:ExercicioFrame}}, Path=MostrarGraficosFletores, Converter={StaticResource BooleanToVisibilityConverter}}">
                        <ContainerUIElement3D.Children>
                            <p3d:Square3D x:Name="Grafico_FletorAB"
                                          Material="{StaticResource Material_Grafico_FletorAB}"
                                          BackMaterial="{Binding RelativeSource={RelativeSource Self}, Path=Material}"
                                          Transform="{StaticResource Transform_Grafico_FletorAB}"
                                          ToolTipService.ToolTip="Fletor - AB: 2 kN.m -> 6 kN.m" />
                            <p3d:Square3D x:Name="Grafico_FletorCD"
                                          Material="{StaticResource Material_Grafico_FletorCD}"
                                          BackMaterial="{Binding RelativeSource={RelativeSource Self}, Path=Material}"
                                          Transform="{StaticResource Transform_Grafico_FletorCD}"
                                          ToolTipService.ToolTip="Fletor - CD: 2 kN.m -> 0" />
                            <p3d:Square3D x:Name="Grafico_FletorBC"
                                          Material="{StaticResource Material_Grafico_FletorBC}"
                                          BackMaterial="{Binding RelativeSource={RelativeSource Self}, Path=Material}"
                                          Transform="{StaticResource Transform_Grafico_FletorBC}"
                                          ToolTipService.ToolTip="Fletor - BC: 2 kN.m" />
                        </ContainerUIElement3D.Children>
                    </ContainerUIElement3D>
                    <!-- Torçores -->
                    <ContainerUIElement3D x:Name="Graficos_Torcores"
                                          Visibility="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type ctrls:ExercicioFrame}}, Path=MostrarGraficosTorcores, Converter={StaticResource BooleanToVisibilityConverter}}">
                        <ContainerUIElement3D.Children>
                            <p3d:Square3D x:Name="Grafico_TorcorAB"
                                          Material="{StaticResource Material_Grafico_TorcorAB}"
                                          BackMaterial="{Binding RelativeSource={RelativeSource Self}, Path=Material}"
                                          Transform="{StaticResource Transform_Grafico_TorcorAB}"
                                          ToolTipService.ToolTip="Torçor - AB: -2 kN.m" />
                        </ContainerUIElement3D.Children>
                    </ContainerUIElement3D>
                    <!-- Normais -->
                    <ContainerUIElement3D x:Name="Graficos_Normais"
                                          Visibility="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type ctrls:ExercicioFrame}}, Path=MostrarGraficosNormais, Converter={StaticResource BooleanToVisibilityConverter}}">
                        <ContainerUIElement3D.Children>
                            <p3d:Square3D x:Name="Grafico_NormalBC"
                                          Material="{StaticResource Material_Grafico_NormalBC}"
                                          BackMaterial="{Binding RelativeSource={RelativeSource Self}, Path=Material}"
                                          Transform="{StaticResource Transform_Grafico_NormalBC}"
                                          ToolTipService.ToolTip="Normal - BC: 1 kN - Tração" />
                        </ContainerUIElement3D.Children>
                    </ContainerUIElement3D>
                </ContainerUIElement3D.Children>
            </ContainerUIElement3D>
        </Viewport3D>
    </tools:TrackballDecorator>
</ctrls:Exercicio>
